package projet_v1.items.ammo;

import projet_v1.Character;
import projet_v1.Item;

/**
 * This class manages ammos
 * 
 * @author Alexis Laurent
 *
 */
public class Ammo extends Item {
	
	// the category, e.g. .45mm
	private CategoryAmmo category;	
	// remaining ammo
	private int remainingAmmo;
	
	 /**
     * Constructor of Ammo class.
     * 
     * @param c
     * 			: the category of the ammo
     */
	public Ammo(CategoryAmmo c) {
		super(Item.CODE_AMMO_ITEM);
		this.category = c;
		this.remainingAmmo = c.getNbInit();		
	}
	
	// Accessors
	public void setRemainingAmmo(int i) {
		remainingAmmo = i;
	}
	
	public int getRemainingAmmo() {
		return remainingAmmo;
	}
	
	public CategoryAmmo getCategoryAmmo() {
		return category;
	}
	
	/**
	 * Decrease the number of ammunitions
	 */
	public void decreaseRemainingAmmo() {
		if(remainingAmmo > 0)
			remainingAmmo--;
	}

	@Override
	public void use(Character c) {
		// do nothing
	}

}
